home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
netsnake
/
mainmodu.bas
< prev
next >
Wrap
BASIC Source File
|
1999-07-26
|
2KB
|
80 lines
Attribute VB_Name = "mainModule"
Public Const IN_FILENAME = "f"
Public Const IN_DATA = "o"
Public Const DONE = "d"
Public Const RECEIVED = "i"
Public Const GOT_FILENAME = "k"
Public Const READY = "r"
Public Const BUFFER = "b"
Public fullCount As Long
Public Data As String
Public Response As String
Public inFile As String
Public outFile As String
Sub WaitFor(WaitFor As String)
On Error Resume Next
Do While Response <> WaitFor
DoEvents
Loop
End Sub
Function Parse(ByVal parseStringx, ByVal argNum As Integer) As Variant
On Error Resume Next
Dim lastPos As Integer
Dim subPos As Integer
Dim argPos(1 To 50) As Integer
Dim argContent(1 To 50)
parseString = parseStringx
parseString = Trim(Right(parseString, ((Len(parseString)) - (InStr(parseString, " ")))))
parseString = parseString & " " 'save my ass some work
'count arguments
argCount = 0
Do
DoEvents
lastPos = InStr((lastPos + 1), parseString, " ")
If lastPos = 0 Then Exit Do
argCount = argCount + 1
argPos(argCount) = lastPos
Loop
If argCount = 0 Then Exit Function
'end count arguments
'get argument content
For i = 1 To argCount
Select Case i
Case argCount
If argCount <> 1 Then
subPos = argPos(i - 1)
Else
subPos = 1
End If
Case 1
subPos = 1
Case Else
subPos = argPos(i - 1)
End Select
DoEvents
argContent(i) = Trim(Mid(parseString, subPos, (argPos(i) - subPos)))
Next i
'end get argument content
Parse = argContent(argNum)
End Function
Function argArray(ByVal startPos As Integer, endPos As Integer) As String
Dim x As String
Parse comFull, 1
For i = startPos To endPos
DoEvents
x = x & Parse(comFull, i) & " "
Next i
argArray = Trim(x)
End Function